/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GameObject;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Point;
import java.util.Timer;

/**
 *
 * @author NGUYEN VAN TAM
 */
public class Window  extends VisibleGameObject{
    public enum State
    {
        Hover,Click,None
    }
    
    public State state;
    public String[] _textDisplay;
    public Point[] _positionText;
    public Font[] _font;
    public Color[] _color;
    public boolean show;
    
    public boolean Init(int _numberSprite[], int _Width,int _Heigth,String StrResource[],int isprite)
    {
        return true;
    }
    
    public void Update(Timer gameTime)
    {
        for (int i = 0; i < _sprite.length; i++)
        {
            _sprite[i].update(gameTime);
        }
    }

    public void Update(Timer gameTime,int x, int y, int w, int h)
    {
        if(show == true)
        {
            if(nDelay == 0)
            {
                this.x = x;
                this.y = y;
                this.width = w;
                this.height = h;

                for (int i = 0; i < _sprite.length; i++)
                {
                    _sprite[i].update(gameTime,x,y,w,h,_sprite[i]._selectedIndex);
                }
            }
            else 
            {
                nDelay --;
            }
        }
    }

    public void Draw(Timer gameTime,Graphics2D graphic)
    {
        if(show == true)
        {
            for (int i = 0; i < _sprite.length; i++)
            {
                _sprite[i].Draw(gameTime,graphic);
            }
            for(int i = 0; i < _textDisplay.length;i++)
            {
                graphic.setFont(_font[i]);
                graphic.setColor(_color[i]);
                graphic.drawString(_textDisplay[i], _positionText[i].x + x, _positionText[i].y + y);
            }
        }
    }
    
    public void SetText(String[] textDisplay, Point[] positionText, Font[] font,Color[] color)
    {
        _textDisplay = textDisplay;
        _positionText = positionText;
        _color = color;
        _font = font;
    }
    
    public void SetShow(boolean _show)
    {
        show = _show;
    }
}
